package io.github.loserya.core.sdk.aggregate.entity;

import org.bson.Document;
import org.springframework.data.mongodb.core.aggregation.AggregationOperation;
import org.springframework.data.mongodb.core.aggregation.AggregationOperationContext;

public class CustomGroupOperation implements AggregationOperation {

    private final Document groupFields;

    public CustomGroupOperation(Document groupFields) {
        this.groupFields = groupFields;
    }

    @Override
    public Document toDocument(AggregationOperationContext context) {
        return new Document("$group", groupFields);
    }
}